﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Linq;

namespace QuanLyTiemThuocTay
{
    public partial class frmTemp : DevExpress.XtraEditors.XtraForm
    {
        QLTTDataContext db = new QLTTDataContext();
        public frmTemp()
        {
            InitializeComponent();
        }

        private void frmTemp_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'qUANLYTHUOCDataSet.DVTINH' table. You can move, or remove it, as needed.
          //  this.dVTINHTableAdapter.Fill(this.qUANLYTHUOCDataSet.DVTINH);
            // TODO: This line of code loads data into the 'qUANLYTHUOCDataSet.LOAI' table. You can move, or remove it, as needed.
            // this.lOAITableAdapter.Fill(this.qUANLYTHUOCDataSet.LOAI);
            //leLoai.DataSource = new BindingList<LOAI>(db.LOAIs.ToList());
            //leDVTinh.DataSource = new BindingList<LOAI>(db.LOAIs.ToList());
            //// TODO: This line of code loads data into the 'qUANLYTHUOCDataSet.THUOC' table. You can move, or remove it, as needed.
            //gc.DataSource = new BindingList<THUOC>(db.THUOCs.ToList());

        }

        private void gv_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
        {
            var rownew = e.Row as THUOC;
            db.THUOCs.InsertOnSubmit(rownew);
            db.SubmitChanges();
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
           // gv.AddNewRow();
        }
    }
}